﻿using System;
using System.Text;
using Core.Domain.Lexems;

namespace Core.SyntaxAnalysis.Classes
{
    public class IntegerConst : Expr
    {
        public IntegerConst(Lexem lex)
        {
            if (lex is ConstLexem<int>)
            {
                Lex = lex;
                Type = new Integer();
            }
            else
            {
                throw new ArgumentException("IntegerConst должна иметь тип constInt");
            }
        }

        public override DataType GetExprType()
        {
            return Type;
        }

        public override string ExprGenerate(StringBuilder s)
        {
            return Lex.StrValue;
        }
    }
}